<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>es7</title>
<script>
{
  // includes
  let arr = [12, 5, 8]

  alert(arr.includes(99))
}
{
  // for...in 和 for...of
  let arr = [12, 15, 8, 99, 31]
  let json = { a: 12, b: 5, c:99 }

  for (let i in json) {
    alert(i)
  }

  for (let i of arr.keys()) {
    alert(i)
  }
  for (let i of arr.values()) {
    alert(i)
  }
  for (let [key, value] of arr.entries()) {
    alert(`${key}-${value}`)
  }
}
{
  // padStart/padEnd
  console.log('【' + 'abc'.padStart(5) + '】')  // 5位不够位数向前补
  console.log('【' + 'abc'.padEnd(5) + '】')  // 5位不够位数向后补
  console.log('【' + 'abc'.padStart(5, '+') + '】')  // 5位不够位数向前补 +
  console.log('【' + 'abc'.padEnd(5, '+') + '】')  // 5位不够位数向后补 +
}
</script>
<script>
{
  // async和await
  async function show() {
    alert('a')

    await

    alert('b')    
  }
  // 请求
  let readData = async () => {
    let data1 = await $.ajax({ url 'a.json' })
    let data2 = await $.ajax({ url 'b.json' })
    let data3 = await $.ajax({ url 'c.json' })
    console.log(data1, data2, data3)
  }
}
</script>
</head>

<body>
  <h6>[数组]includes => 检查数据中是否有某项。</h6>
  <h6>[数组]keys/values/entries(键值对) => for...of配合使用，for...in使用于数组和JSON，但for...of目前es7版本不支持用于JSON循环，只能用于数组。</h6>
  <h6>[求幂] => 3的8次方：3**8</h6>
  <h6>[字符串]padStart/padEnd</h6>
  <h6>语法容忍度 => 数组：[1, 2, 3,]；方法：function (a, b, c,) {}；</h6>
  <h6>async和await：可以写成箭头函数。generator不可以。</h6>
</body>

</html>